package com.spring;

import com.spring.service.BeanService;
import com.spring.service.BeanServiceImpl;
import com.spring.service.ThreadPoolService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;

@SpringBootApplication(scanBasePackages = {"com.spring","com.example"})
@EnableAsync
public class StartApplication {
    public static ConfigurableApplicationContext configurableApplicationContext;
    public static void main(String[] args) {
        configurableApplicationContext = SpringApplication.run(StartApplication.class, args);
        //BeanService service =  configurableApplicationContext.getBean(BeanServiceImpl.class);

        ThreadPoolService threadPoolService = configurableApplicationContext.getBean(ThreadPoolService.class);
        threadPoolService.test2();
        threadPoolService.testAsync();
        System.out.println("threadPoolService 测试完成");
    }
}
